home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Basic / Visual Basic.60 / COMMON / TOOLS / VCM / VCM.MDB / VcmComponentContainer / 16_Cabinet / Fflex.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-05-18  |  6.3 KB  |  193 lines

  1. VERSION 5.00
  2. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFlxGrd.Ocx"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "ComDlg32.OCX"
  4. Begin VB.Form Form1 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "FlexGrid Sample"
  7.    ClientHeight    =   3930
  8.    ClientLeft      =   3030
  9.    ClientTop       =   5790
  10.    ClientWidth     =   8235
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3930
  15.    ScaleWidth      =   8235
  16.    Begin VB.Data Data1 
  17.       Caption         =   "Data1"
  18.       Connect         =   "Access"
  19.       DatabaseName    =   ""
  20.       DefaultCursorType=   0  'DefaultCursor
  21.       DefaultType     =   2  'UseODBC
  22.       Exclusive       =   0   'False
  23.       Height          =   375
  24.       Left            =   6360
  25.       Options         =   0
  26.       ReadOnly        =   0   'False
  27.       RecordsetType   =   2  'Snapshot
  28.       RecordSource    =   "Title Author"
  29.       Top             =   3240
  30.       Visible         =   0   'False
  31.       Width           =   1815
  32.    End
  33.    Begin MSFlexGridLib.MSFlexGrid flex 
  34.       Bindings        =   "fFlex.frx":0000
  35.       DragIcon        =   "fFlex.frx":0014
  36.       Height          =   3135
  37.       Left            =   120
  38.       TabIndex        =   0
  39.       Top             =   600
  40.       Width           =   6135
  41.       _ExtentX        =   10821
  42.       _ExtentY        =   5530
  43.       _Version        =   393216
  44.       Cols            =   3
  45.       FixedCols       =   0
  46.       BackColorFixed  =   0
  47.       ForeColorFixed  =   16776960
  48.       GridColor       =   -2147483630
  49.       HighLight       =   2
  50.       SelectionMode   =   1
  51.       AllowUserResizing=   1
  52.       BorderStyle     =   0
  53.    End
  54.    Begin MSComDlg.CommonDialog CommonDialog1 
  55.       Left            =   6480
  56.       Top             =   2640
  57.       _ExtentX        =   847
  58.       _ExtentY        =   847
  59.       _Version        =   393216
  60.       FontSize        =   1.73857e-39
  61.    End
  62.    Begin VB.Image Image1 
  63.       Height          =   1440
  64.       Left            =   3720
  65.       Picture         =   "fFlex.frx":0456
  66.       Stretch         =   -1  'True
  67.       Top             =   600
  68.       Width           =   4215
  69.    End
  70.    Begin VB.Label Label1 
  71.       Alignment       =   2  'Center
  72.       BackColor       =   &H00FFFFFF&
  73.       BorderStyle     =   1  'Fixed Single
  74.       Caption         =   "Drag and Drop any column to pivot the data"
  75.       ForeColor       =   &H00808080&
  76.       Height          =   735
  77.       Left            =   6600
  78.       TabIndex        =   2
  79.       Top             =   0
  80.       Width           =   1335
  81.    End
  82.    Begin VB.Label lblTitle 
  83.       Alignment       =   2  'Center
  84.       BackColor       =   &H00000000&
  85.       Caption         =   "Flex Summary"
  86.       BeginProperty Font 
  87.          Name            =   "Arial"
  88.          Size            =   21.75
  89.          Charset         =   0
  90.          Weight          =   700
  91.          Underline       =   0   'False
  92.          Italic          =   0   'False
  93.          Strikethrough   =   0   'False
  94.       EndProperty
  95.       ForeColor       =   &H000000FF&
  96.       Height          =   615
  97.       Left            =   120
  98.       TabIndex        =   1
  99.       Top             =   0
  100.       Width           =   6135
  101.    End
  102. Attribute VB_Name = "Form1"
  103. Attribute VB_GlobalNameSpace = False
  104. Attribute VB_Creatable = False
  105. Attribute VB_PredeclaredId = True
  106. Attribute VB_Exposed = False
  107. Option Explicit
  108. Private Sub flex_DragDrop(Source As VB.Control, X As Single, Y As Single)
  109.     If flex.Tag = "" Then Exit Sub
  110.     flex.Redraw = False
  111.     flex.ColPosition(Val(flex.Tag)) = flex.MouseCol
  112.     DoSort
  113.     flex.Redraw = True
  114. End Sub
  115. Private Sub flex_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  116.     flex.Tag = ""
  117.     If flex.MouseRow <> 0 Then Exit Sub
  118.     flex.Tag = Str(flex.MouseCol)
  119.     flex.Drag 1
  120. End Sub
  121. Private Sub Form_Load()
  122. On Error GoTo FormLoad_Err
  123.         
  124.   Data1.DatabaseName = CurDir & "\biblio.mdb"
  125.   flex.Redraw = False
  126.   DoInitialSettings
  127.   DoSql
  128.   DoSort
  129.   Data1.Refresh
  130.   flex.Redraw = True
  131. FormLoad_Exit:
  132. Exit Sub
  133. FormLoad_Err:
  134.     'advanced error handling is required if the database cannot be
  135.     'found as error 3024 would indicate.
  136.     If Err = 3024 Then
  137.         'set CommonDialog properties before showing
  138.         With CommonDialog1
  139.           .DialogTitle = "Unable to find the biblio.mdb file location"
  140.           .Filter = "(*.mdb)|*.mdb"
  141.           .InitDir = CurDir
  142.           .FileName = "biblio.mdb"
  143.           .Flags = cdlOFNExplorer Or cdlOFNFileMustExist Or cdlOFNPathMustExist
  144.           .ShowOpen
  145.           'make sure the filename is not an empty string
  146.           If .FileName <> "" Then
  147.             'make sure that the database file returned is indeed biblio.mdb
  148.             If Right(UCase(.FileName), Len("biblio.mdb")) = "BIBLIO.MDB" Then
  149.             Data1.DatabaseName = .FileName
  150.             End If
  151.             Resume
  152.           Else
  153.             Unload Me
  154.           End If
  155.         End With
  156.     ElseIf Err <> 0 Then ' another error
  157.         MsgBox "Unexpected Error: " & Err.Description
  158.         End
  159.     End If
  160.     Resume FormLoad_Exit
  161. End Sub
  162. Sub DoInitialSettings()
  163.     Dim i%
  164.     flex.Row = 0
  165.     flex.ColAlignment(0) = 7
  166.     For i = 0 To flex.Cols - 1
  167.         flex.Col = i
  168.         flex.CellFontSize = 14
  169.         flex.CellAlignment = 4
  170.         
  171.         flex.MergeCol(i) = True     ' Allow merge on Columns 0 thru 3
  172.         flex.ColWidth(i) = 2000     ' Set column's width
  173.     Next i
  174.     flex.MergeCells = flexMergeRestrictColumns
  175. End Sub
  176. Sub DoSql()
  177.     Dim mysql$
  178.     mysql$ = "SELECT "
  179.     mysql = mysql & "Publishers.[Company Name], "
  180.     mysql = mysql & "Authors.Author, "
  181.     mysql = mysql & "Titles.Title "
  182.     mysql = mysql & "FROM Authors INNER JOIN "
  183.     mysql = mysql & "(Publishers INNER JOIN ([title author] INNER JOIN Titles ON [title author].ISBN = Titles.ISBN) ON Publishers.PubID = Titles.PubID) "
  184.     mysql = mysql & "ON Authors.Au_ID = [title author].Au_ID "
  185.     mysql = mysql & "WHERE Authors.Au_ID < 30 "
  186.     Data1.RecordSource = mysql
  187. End Sub
  188. Sub DoSort()
  189.     flex.Col = 0
  190.     flex.ColSel = flex.Cols - 1
  191.     flex.Sort = 1 ' Generic Ascending
  192. End Sub
  193.